package org.bangumibuddy.mapper;

import org.apache.ibatis.annotations.*;
import org.bangumibuddy.entity.RssEntity;
import org.bangumibuddy.handler.StringListTypeHandler;

import java.util.List;

@Mapper
public interface RssMapper {

    int addRss(RssEntity rss);

    @Select("SELECT * FROM rss WHERE id = #{id}")
    @ResultMap("rssEntityResultMap")
    RssEntity getRssById(Long id);

    @Select("SELECT * FROM rss WHERE url = #{rssUrl}")
    @ResultMap("rssEntityResultMap")
    RssEntity getRssByURL(String rssUrl);


    @Select("SELECT * FROM rss WHERE animeId = #{id}")
    @ResultMap("rssEntityResultMap")
    List<RssEntity> getRssByAnimeId(Long id);
}
